package com.cheksin.excl;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 不愿透露
 * @Classname ReadText
 * @Description TODO
 * @Date 2021/11/23 14:42
 */
public class ReadText {
    public static void main(String[] args) {
        System.out.println(readFileContent("d:\\过期产品.txt"));
    }
    public static List<String> readFileContent(String fileName) {
        List<String> buffer = new ArrayList<>();
        File file = new File(fileName);
        BufferedReader reader = null;
        StringBuffer sbf = new StringBuffer();
        try {
            reader = new BufferedReader(new FileReader(file));
            String tempStr;
            while ((tempStr = reader.readLine()) != null) {
                buffer.add(tempStr);
            }
            reader.close();
            return buffer;
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
        }
        return buffer;
    }
}